package com.prs.crm.service.crm.impl;

import java.io.File;
import java.util.Collection;

import com.prs.crm.context.FileUtil;
import com.prs.crm.context.ToolKits;
import com.prs.crm.dao.crm.FeedbackDao;
import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.crm.Feedback;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.service.crm.FeedbackService;
import com.prs.crm.service.impl.BaseServiceImpl;

public class FeedbackServiceImpl extends BaseServiceImpl<Feedback,FeedbackDao> implements FeedbackService{

	@Override
	public void submitFeedback(Feedback feedback, File file, String fileName) {
		// TODO Auto-generated method stub
		Attachment attach = FileUtil.getInstance().createAttach(file, fileName);
		if(attach != null) {
			feedback.setAttach(attach);
		}
		this.getDao().save(feedback);
	}

	@Override
	public Collection<Feedback> getFeedbackByReplyerInNow(Person person) {
		// TODO Auto-generated method stub
		return this.getDao().getFeedbackByReplyerInNow(person);
	}

	@Override
	public Collection<Feedback> getFeedbackByIds(Integer[] ids) {
		// TODO Auto-generated method stub
		return this.getDao().getFeedbackByIds(ToolKits.convertToIntAry(ids));
	}

}
